package com.springmvc.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.springmvc.demo.model.Role;



@Mapper
public interface RoleMapper{
    @Insert("Insert Into t_role (roleid,remark,rolename) VALUES(#{roleid},#{remark},#{rolename})")
    void insertRole(Role role);
    
    @Select("SELECT * FROM t_role WHERE roleid = #{roleid}")
    Role findRoleByRoleid(@Param("roleid")int roleid);
    
    @Select("SELECT * FROM t_role WHERE rolename = #{rolename}")
    Role findRoleByRoleName(@Param("roleid")String rolename);
    
    @Select("SELECT * FROM t_role")
    List<Role> listAllRole();
    
    @Delete("Delete FROM t_role where roleid=#{roleid}")
    int deleteUser(@Param("roleid")String roleid);
    
}
